package ynu.edu.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Service;
import ynu.edu.mapper.IBusinessMapper;
import ynu.edu.po.Business;
import ynu.edu.service.IBusinessService;

import java.util.List;

@Service
public class BusinessServiceImpl implements IBusinessService {
    @Resource
    private IBusinessMapper businessMapper;

    @Override
    public List<Business> listBusinessByOrderTypeId(Integer orderTypeId) {
        QueryWrapper<Business> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("orderTypeId", orderTypeId).orderByAsc("businessId");
        return businessMapper.selectList(queryWrapper);
    }

    @Override
    public Business getBusinessById(Integer businessId) {
        return businessMapper.selectById(businessId);
    }

    @Override
    public List<Business> listAllBusiness() {
        QueryWrapper<Business> queryWrapper = new QueryWrapper<>();
        return businessMapper.selectList(queryWrapper);
    }
}
